import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { ApiProvider } from '../../providers/api/api';

/**
 * Generated class for the JoinPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-join',
  templateUrl: 'join.html',
})
export class JoinPage {

  joinCode;

  constructor(public navCtrl: NavController, public navParams: NavParams, public http: ApiProvider) {
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad JoinPage');
  }
  //
  // async join() {
  //   let res = await this.http._post('/joinCourse',this.joinCode);
  //   console.log(res);
  // }

  join() {
    this.http.post('/joinCourse', this.joinCode).subscribe(res => {
      console.log(res);
    })
  }

}
